package io.lb.deng.webflux.service;

import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.CommandLineRunner;
import org.springframework.core.annotation.Order;
import org.springframework.stereotype.Component;

import io.lb.deng.starter.ProjectProperties;

/**
 * @Project
 * @Module
 * @JDK_Vserion 1.8
 * @Author DengLibin
 * @Email dlb@smarthse.cn
 * @Desc
 * @since 2020/3/13 0013 9:53
 */
@Component
@Order(1) // 执行顺序（如果有多个）
public class StartRunner implements CommandLineRunner {
    private Logger logger = LoggerFactory.getLogger(getClass());
    private ProjectProperties projectProperties;
    @Autowired
    public void setProjectProperties(ProjectProperties projectProperties){
        this.projectProperties = projectProperties;
    }
    /**
     * 启动完成后的回调方法
     * @param args
     */
    @Override
    public void run(String... args) {
        logger.info("======================>启动完成<=====================");
        switch (projectProperties.getEnvEnum()){
            case TEST:
                logger.info("测试环境");
                break;
            case DEV:
                logger.info("开发环境");
                break;
            case PRO:
                logger.info("生产环境");
                break;
            default:
                break;
        }
    }
}
